package com.Page.conf;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.common.base.Predicate;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * 
* Copyright: Copyright (c) 2019 YancyChong.All rights reserved.
* 
* @ClassName: SwaggerConfig.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: YancyChong
* @date: 2019年5月15日 下午8:55:03 
*
* Modification History：
* Date         Author          Version            Description
*---------------------------------------------------------*
* 2019年5月15日     User           v1.0.0               修改原因
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
	@Value("${sys.version}")
	private String systemPublish;
	
//	or(regex("/v1/open/test/.*"))
	@Bean
    public Docket testApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("考试相关API")
                .pathMapping("/")
                .select()
                .paths(new Predicate<String>() {
					
					@Override
					public boolean apply(String input) {
						return input.matches("/v1/open/test/.*");
					}
				})//过滤的接口
                .build()
                .apiInfo(new ApiInfoBuilder()
                        .title("考试相关API")
                        .version(systemPublish)
                        .build());
    }


}
